<?php
namespace serv\task\product;

use L;
use of\base\com\mq;

class product
{
    //同步SKU产品表中新增的
    public static function check()
    {
        $time = date('Y-m-d H:i:s', time() - 1 * 3600);
        $sql = "SELECT * FROM product_sku WHERE 1 AND '{$time}' <= updated_at;";
        $result = L::sql($sql, 'product');
        if (!empty($result)) {
            foreach ($result as $k => $v) {
                $key = "checkProductStock_{$v['product_id']}";
                //echo json_encode($v, JSON_UNESCAPED_UNICODE); exit;
                mq::set(["checkProductStock", $key, $k * 1], $v);
            }
        }
    }
}
